Xbasic
Array for_each Method
Syntax
List as C = <array>.for_each(format as C [, filter as C])
Arguments
- formatCharacter
An Xbasic expression defining how entries are formatted. Individual properties can be referenced by the format expression. See example below.
- filterCharacter
Default = "". A filter expression that returns a true (.t.) or false (.f.) value used to determines what values to include in the result.
Returns
- ListCharacter
A CR-LF delimited list of formatted array entries.
Description
Converts a property array to a formatted list of CR-LF separated entries.
Discussion
The <array>.for_each() method creates a CR-LF delimited list of formatted entries for a property array. This method can only be used with property arrays.
Example
dim arr[0] as p i = arr.append() arr[i].fname = "john" arr[i].lname = "smith" i = arr.append() arr[i].fname = "tim" arr[i].lname = "jones" i = arr.append() arr[i].fname = "liz" arr[i].lname = "harrison" ? arr.for_each("f_upper(lname)+\", \"+f_upper(fname)") = Smith, John Jones, Tim Harrison, Liz ? arr.for_each("f_upper(fname)","lname<'m'") = Tim Liz
See Also